package com.eurabia.eggchat.utils;






import com.eurabia.eggchat.VO.ResultVO;

import java.util.List;

/**
 * @author zqx
 * @date 2018.07.19
 */
public class ResultVOUtil {

    public static ResultVO success(List object)
    {
        ResultVO resultVO = new ResultVO();
        resultVO.setData(object);
        resultVO.setCode("0");
        resultVO.setMsg("成功");
        if(object == null)
        {
            resultVO.setCount(1);
        }else
        {
            resultVO.setCount(object.size());
        }
        return resultVO;
    }

    public static ResultVO success()
    {
        return success(null);
    }

    public static ResultVO error(String code,String msg)
    {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }
}
